From: David Zeuthen Date: Mon, 14 Mar 2011 14:32:15 +0000 (-0400) Subject: clock: update every second X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~1013^2^2~8679 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=4b2d6f8a992e55027dcffba8f6c7aac2318522a8;p=gnome-shell.git clock: update every second If we don't update every second, we may show the wrong time for up to a minute on 1. resume; or 2. when changing the time; or 3. when changing the timezone. This is both annoying and and leads to people thinking that the tool for changing the time / timezone is broken. https://bugzilla.gnome.org/show_bug.cgi?id=635840 Signed-off-by: David Zeuthen --- diff --git a/js/ui/dateMenu.js b/js/ui/dateMenu.js index ad2c112ef..8d35bbcef 100644 --- a/js/ui/dateMenu.js +++ b/js/ui/dateMenu.js @@ -185,21 +185,6 @@ DateMenuButton.prototype = { } let displayDate = new Date(); - let msecRemaining; - if (showSeconds) { - msecRemaining = 1000 - displayDate.getMilliseconds(); - if (msecRemaining < 50) { - displayDate.setSeconds(displayDate.getSeconds() + 1); - msecRemaining += 1000; - } - } else { - msecRemaining = 60000 - (1000 * displayDate.getSeconds() + - displayDate.getMilliseconds()); - if (msecRemaining < 500) { - displayDate.setMinutes(displayDate.getMinutes() + 1); - msecRemaining += 60000; - } - } this._clock.set_text(displayDate.toLocaleFormat(clockFormat)); @@ -209,7 +194,7 @@ DateMenuButton.prototype = { dateFormat = _("%A %B %e, %Y"); this._date.set_text(displayDate.toLocaleFormat(dateFormat)); - Mainloop.timeout_add(msecRemaining, Lang.bind(this, this._updateClockAndDate)); + Mainloop.timeout_add_seconds(1, Lang.bind(this, this._updateClockAndDate)); return false; },